package com.dms.shanshan.beans.config;

import com.dms.shanshan.beans.PropertyValues;

/**
 * bean的定义
 * @author dongms
 * @date 2020/07/09
 */
public class BeanDefinition {
    private Class<?> beanClass; //bean的类型
    private String beanClassName;
    private PropertyValues propertyValues; //bean的属性
    private String initMethodName; //初始化方法
    private String destroyMethodName; //销毁方法
    private boolean singleton = true; //是否单例
    private boolean prototype = false; //是否多例

    /**
     * 默认作用域
     */
    public static final String SCOPE_SINGLETON = "singleton";
    public static final String SCOPE_PROTOTYPE = "prototype";

    public BeanDefinition(String s, PropertyValues pvs) {
        this.beanClassName = s;
        this.propertyValues = pvs;
    }

    @Override
    public String toString() {
        return "BeanDefinition{" +
                "beanClass=" + beanClass +
                ", beanClassName='" + beanClassName + '\'' +
                ", propertyValues=" + propertyValues +
                ", initMethodName='" + initMethodName + '\'' +
                ", destroyMethodName='" + destroyMethodName + '\'' +
                ", singleton=" + singleton +
                ", prototype=" + prototype +
                '}';
    }
}
